//abstract class Animal{
//    public abstract void cry();
//    public abstract String getAnimalName();
//}
//class Dog extends Animal{
//    public String getAnimalName(){
//        return "Dog";
//    }
//    public void cry(){
//        System.out.println("汪汪!");
//    }
//}
//class Cat extends Animal{
//    public void cry(){
//        System.out.println("喵喵~");
//    }
//    public String getAnimalName(){
//        return "Cat";
//    }
//}
//class Simulator{
//    public void playSound(Animal animal){
//        System.out.print("现在播放"+animal.getAnimalName()+"的声音:");
//        animal.cry();
//    }
//}
//public class Application {
//    public static void main(String[] args) {
//        Simulator simulator=new Simulator();
//        simulator.playSound(new Dog());
//        simulator.playSound((new Cat()));
//    }
//}




interface Animal{
    public abstract void cry();
    public abstract String getAnimalName();
}
class Dog implements Animal{
    public String getAnimalName(){
        return "Dog";
    }
    public void cry(){
        System.out.println("汪汪!");
    }
}
class Cat implements Animal{
    public void cry(){
        System.out.println("喵喵~");
    }
    public String getAnimalName(){
        return "Cat";
    }
}
class Simulator{
    public void playSound(Animal animal){
        System.out.print("现在播放"+animal.getAnimalName()+"的声音:");
        animal.cry();
    }
}
public class Application {
    public static void main(String[] args) {
        Simulator simulator=new Simulator();
        simulator.playSound(new Dog());
        simulator.playSound((new Cat()));
    }
}
